//医保类型获取下标
const getinsuranceTypeIndex=target=>{
    var index =0;
    switch (target) {
        case 0:
            index = 0
            break;
        case 12:
            index = 1
            break;
        case 3:
            index = 2
            break;
        case 2:
            index = 3
            break;
        case 1:
            index = 4
            break;
        case 4:
            index = 5
            break;
        case 6:
            index = 6
            break;
        case 7:
            index = 7
            break;
        case 8:
            index = 8
            break;
        case 9:
            index = 9
            break;
        case 10:
            index = 10
            break;
        case 11:
            index = 11
            break;
        case 13:
            index = 12
            break;
        case 14:
            index = 13
            break;
        case 15:
            index = 14
            break;
        case 16:
            index = 15
            break;
        case 17:
            index = 16
            break;
        case 5:
            index = 17
            break;
        default:
            index = 0
            break;
    }
    return index
}

//病种获取下标
const getdiseaseArrayIndex=target=>{
    var index =0;
    switch (target) {
        case 0:
            index = 0
            break;
        case 7:
            index = 1
            break;
        case 3:
            index = 2
            break;
        case 11:
            index = 3
            break;
        case 2:
            index = 4
            break;
        case 8:
            index = 5
            break;
        case 5:
            index = 6
            break;
        case 1:
            index = 7
            break;
        case 9:
            index = 8
            break;
        case 4:
            index = 9
            break;
        case 10:
            index = 10
            break;
        case 12:
            index = 11
            break;
        case 6:
            index = 12
            break;
        case 14:
            index = 13
            break;
        case 15:
            index = 14
            break;
        case 13:
            index = 15
            break;
        default:
            index = 0
            break;
    }
    return index
}

//获取下标
/**
 * 
 *
 * @param {*} targetObj 目标对象
 * @param {*} entityidName 目标ID名称
 * @param {*} id  目标ID
 * @returns 目标ID的下标
 */
const getPickerValue = (targetObj, entityidName, id) => {
    for (let index in targetObj) {
        if (targetObj[index][entityidName] == id) {
            return index
        }
    }
}

module.exports={
    getinsuranceTypeIndex,
    getPickerValue,
    getdiseaseArrayIndex
}